public class CalculatePrimes {
	
	private int upperBound=0;
	
	public CalculatePrimes(int upperBound){
		if(upperBound>Integer.MAX_VALUE)System.out.println("OUT OF RANGE");
		this.upperBound=upperBound;
	}

	public int getUpperBound(){
			return upperBound;
	}
	
	public boolean[] calculateUpToBound(){
				
		boolean[] PrimArray = new boolean[upperBound+1];
		
		PrimArray[0]=false;
		PrimArray[1]=false;
		
		for(int i=2; (i<Integer.MAX_VALUE) && (i<upperBound); i++){
			PrimArray[i] = true;
		}
		
		for(int i=2; (i<Integer.MAX_VALUE) && (i<upperBound); i++){
			if(PrimArray[i]==true){
				int j = i;
				while ((j*i)<upperBound && (i*j>0)){
					//System.out.println(j*i);
					PrimArray[(j*i)] = false;
					j++;
				}
			}
		}
		return PrimArray;
	}
	
		
		public static void main(String[] args) {
			
			
			CalculatePrimes test = new CalculatePrimes(10);
			for(int i=0; i<10+1; i++){
			System.out.print(test.calculateUpToBound()[i]+", ");
			}
			System.out.println("");
			
			
			int Array[] = {5,4,33,60};
			CheckIfPrime Array1 = new CheckIfPrime(Array);
			for(int i=0; i<Array.length; i++){
			System.out.println(Array1.checkIfNumbersInArrayArePrime()[i]);
			}
			
			
			System.out.println(CheckIfPrime.checkIfSingleNumberIsPrime(50505050));
		

	}
	
}
